#define _CRT_SECURE_NO_WARNINGS 1

#include<vector>

using namespace std;

int get(vector<int>& v, int s)
{
    int time = 0;
    for (auto it : v)
    {
        int c = (it + s - 1) / s;
        time += c;
    }
    return time;
}
int minEatingSpeed(vector<int>& piles, int h) {
    int l = 1, r = 0;
    for (auto it : piles)
        r = max(r, it);
    while (l < r)
    {
        int s = l + r >> 1;
        int time = get(piles, s);
        if (time <= h)
        {
            r = s;
        }
        else    l = s + 1;
    }
    return l;
}